package com.itheima.controller;

import com.itheima.pojo.ClazzCountOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.List;
import java.util.Map;

// 报表相关
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private EmpService empService;
    @Autowired
    private StudentService studentService;

    @GetMapping("/empJobData")
    public Result calcJobCount() {
        JobOption jobOption = empService.calcJobCount();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result calcGenderCount() {
        List<Map<String, Object>> list = empService.calcGenderCount();
        return Result.success(list);
    }

    @GetMapping("/studentDegreeData")
    public Result queryStudentDegreeData() {
        List<Map<String, Object>> list = studentService.calcStudentDegreeData();
        return Result.success(list);
    }
    @GetMapping("/studentCountData")
    public Result queryStudentCountData2() {
        ClazzCountOption list = studentService.calcStudentDegreeData2();
        return Result.success(list);
    }
}
